package com.bw.Controller;

import com.bw.Service.EmpService;
import com.bw.bean.Emp;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @BelongsProject: lianxi07
 * @BelongsPackage: com.bw.Controller
 * @Author: wuxiaopeng
 * @CreateTime: 2024-10-07  13:36
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
public class EmpController {
    @Autowired
    EmpService empService;

    @RequestMapping("list1")
    public List<Emp> getlist(){
        List<Emp> list=empService.getlist();
        return list;
    }

    @RequestMapping("list2")
    public List<Emp> getlist2(String ename,String phone){
        List<Emp> list=empService.getlist2(ename,phone);
        return list;
    }

    @RequestMapping("add")
    public int getlist(Emp emp){
        return empService.add(emp);
    }

    @RequestMapping("adds")
    public int adds(@RequestBody List<Emp> emp){
        for (Emp emp1 : emp) {
            System.out.println(emp1);
        }
        return empService.adds(emp);
    }

    @RequestMapping("addss")
    public int addss(@RequestBody List<Emp> emp){
        for (Emp emp1 : emp) {
            System.out.println(emp1);
        }
        return empService.addss(emp);
    }

    @RequestMapping("del")
    public int del(int eid){
        int num=empService.del(eid);
        return num;
    }

    @RequestMapping("dels")
    public int dels(Integer[] eid){
        return empService.dels(eid);
    }
}
